package org.magnerfuller.imtoolkit.server.status;

import java.util.Vector;

import org.magnerfuller.imtoolkit.server.connection.manager.ConnectionManager;
import org.magnerfuller.imtoolkit.server.session.manager.SessionManager;

public class ServerStatus {
  
  private static ServerStatus me = null;
  
  private SessionManager sessionManager = null;
  
  private ConnectionManager connectionManager = null;
  
  public static ServerStatus getInstance() {
    if(me == null) {
      me = new ServerStatus();
    }
    return me;
  }

  public void setSessionManager(SessionManager sessionManager) {
    this.sessionManager = sessionManager;
  }
  
  public void setConnectionManager(ConnectionManager connectionManager) {
    this.connectionManager = connectionManager;
  }
  
  public int getNumSessions() {
    if(sessionManager == null) {
      throw new IllegalStateException("No SessionManager being monitored!");
    }
    return sessionManager.getNumSessions();
  }
  
  public Vector<String> getSessionNames() {
    if(sessionManager == null) {
      throw new IllegalStateException("No SessionManager being monitored!");
    }
    return sessionManager.getSessionNames();
  }
}
